package com.citywithincity.web.request;

import javax.servlet.http.HttpServletRequest;

import com.damai.error.ApiError;

class String2Integer implements IRequestData {

	

	@Override
	public Object getValue(HttpServletRequest request, String name) {
		String value = request.getParameter(name);
		try{
			return value==null ? 0 : Integer.parseInt(value);
		}catch(NumberFormatException e){
			throw new ApiError("参数"+name+"必须为整数");
		}
	}
}
